<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>输入年份输出月有多少天</title>
	</head>
	<body>
        <script>
			var year=prompt("请您输入一个年份");
			var runnian = year%4==0 && year%100!=0 || year%400==0 ;
			for(var i=1;i<=12;i++){
				if(i==4 || i==6 || i==9 || i==11){
					document.write(i + "月有30天<br />");
				}else if(i == 2){
					if(runnian){
						document.write(i + "月有29天<br />");
					}else{
						document.write(i + "月有28天<br />");
					}
				}else{
					document.write(i + "月有31天<br />");
				}
			}
		</script>
	</body>
</html>
